﻿<phone:PhoneApplicationPage
    x:Class="OsmerFvg.Views.MainPageView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:imagetools="clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
    xmlns:bab="clr-namespace:Caliburn.Micro.BindableAppBar;assembly=Caliburn.Micro.BindableAppBar"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False">

    <phone:PhoneApplicationPage.Resources>
        <imagetools:ImageConverter x:Key="ImageConverter" />
        <cal:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    </phone:PhoneApplicationPage.Resources>
    
    <Grid>
        <phone:Panorama HeaderTemplate="{StaticResource TinyPanoramaHeader}" Title="Meteo Friuli Venezia Giulia" TitleTemplate="{StaticResource SmallPanoramaTitle}" Name="MainPanorama">
            <phone:PanoramaItem Header="{Binding Path=TodayItem}">
                <Grid>
                    <TextBlock Height="52" Margin="10,4,0,0" Width="400" FontSize="18" FontWeight="Bold" HorizontalAlignment="Left" Text="{Binding Path=TodayHeader}" TextAlignment="Left" TextTrimming="None" TextWrapping="Wrap" VerticalAlignment="Top" />
                    <Image Height="275" Margin="58,60,0,0" Width="293" HorizontalAlignment="Left" Source="\Images\SfondoPrevisioni.png" VerticalAlignment="Top" Visibility="{Binding Path=LoadComplete,Converter={StaticResource BooleanToVisibilityConverter}}" />
                    <imagetools:AnimatedImage Height="275" Margin="58,60,0,0" Width="293" HorizontalAlignment="Left" Source="{Binding Path=TodayImageSource, Converter={StaticResource ImageConverter}}" Stretch="Uniform" VerticalAlignment="Top" Visibility="{Binding Path=LoadComplete,Converter={StaticResource BooleanToVisibilityConverter}}">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Tap">
                                <cal:ActionMessage MethodName="TodayImageTapCommand" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </imagetools:AnimatedImage>
                    <ScrollViewer Height="191" Margin="8,344,0,0" Width="390" HorizontalAlignment="Left" VerticalAlignment="Top">
                        <TextBlock Width="380" FontSize="18" FontWeight="Bold" Text="{Binding Path=TodayForecast}" TextAlignment="Left" TextTrimming="None" TextWrapping="Wrap" VerticalAlignment="Top" Name="TodayForecast" />
                    </ScrollViewer>
                </Grid>
            </phone:PanoramaItem>
            <phone:PanoramaItem Header="{Binding Path=TomorrowItem}">
                <Grid>
                    <TextBlock Height="52" Margin="10,4,0,0" Width="400" FontSize="18" FontWeight="Bold"  HorizontalAlignment="Left" Text="{Binding Path=TomorrowHeader}" TextAlignment="Left" TextTrimming="None" TextWrapping="Wrap" VerticalAlignment="Top" />
                    <Image Height="275" Margin="58,60,0,0" Width="293" HorizontalAlignment="Left" Source="\Images\SfondoPrevisioni.png" VerticalAlignment="Top" Visibility="{Binding Path=LoadComplete,Converter={StaticResource BooleanToVisibilityConverter}}" />
                    <imagetools:AnimatedImage Height="275" Margin="58,60,0,0" Width="293" HorizontalAlignment="Left" Source="{Binding Path=TomorrowImageSource, Converter={StaticResource ImageConverter}}" Stretch="Uniform" VerticalAlignment="Top" Visibility="{Binding Path=LoadComplete,Converter={StaticResource BooleanToVisibilityConverter}}">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Tap">
                                <cal:ActionMessage MethodName="TomorrowImageTapCommand" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </imagetools:AnimatedImage>
                    <ScrollViewer Height="191" Margin="8,344,0,0" Width="390" HorizontalAlignment="Left" VerticalAlignment="Top">
                        <TextBlock Width="380" FontSize="18" FontWeight="Bold" Text="{Binding Path=TomorrowForecast}" TextAlignment="Left" TextTrimming="None" TextWrapping="Wrap" VerticalAlignment="Top" Name="TomorrowForecast" />
                    </ScrollViewer>
                </Grid>
            </phone:PanoramaItem>
            <phone:PanoramaItem Header="{Binding Path=TomorrowAfterItem}">
                <Grid>
                    <TextBlock Height="52" Margin="10,4,0,0" Width="400" FontSize="18" FontWeight="Bold"  HorizontalAlignment="Left" Text="{Binding Path=TomorrowAfterHeader}" TextAlignment="Left" TextTrimming="None" TextWrapping="Wrap" VerticalAlignment="Top" />
                    <Image Height="275" Margin="58,60,0,0" Width="293" HorizontalAlignment="Left" Source="\Images\SfondoPrevisioni.png" VerticalAlignment="Top" Visibility="{Binding Path=LoadComplete,Converter={StaticResource BooleanToVisibilityConverter}}" />
                    <imagetools:AnimatedImage Height="275" Margin="58,60,0,0" Width="293" HorizontalAlignment="Left" Source="{Binding Path=TomorrowAfterImageSource, Converter={StaticResource ImageConverter}}" Stretch="Uniform" VerticalAlignment="Top" Visibility="{Binding Path=LoadComplete,Converter={StaticResource BooleanToVisibilityConverter}}">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Tap">
                                <cal:ActionMessage MethodName="TomorrowAfterImageTapCommand" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </imagetools:AnimatedImage>
                    <ScrollViewer Height="191" Margin="8,344,0,0" Width="390" HorizontalAlignment="Left" VerticalAlignment="Top">
                        <TextBlock Width="380" FontSize="18" FontWeight="Bold" Text="{Binding Path=TomorrowAfterForecast}" TextAlignment="Left" TextTrimming="None" TextWrapping="Wrap" VerticalAlignment="Top" Name="TomorrowAfterForecast" />
                    </ScrollViewer>
                </Grid>
            </phone:PanoramaItem>



        </phone:Panorama>

        <bab:BindableAppBar x:Name="AppBar">
            <bab:BindableAppBarButton Text="Radar" IconUri= "{Binding RadarIconUri}" >
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <cal:ActionMessage MethodName="RadarIconClickCommand" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </bab:BindableAppBarButton>
            <bab:BindableAppBarButton Text="Web Cams" IconUri= "{Binding WebcamsIconUri}">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <cal:ActionMessage MethodName="WebcamsIconClickCommand" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </bab:BindableAppBarButton>
            <bab:BindableAppBarButton Text="Leggi" IconUri= "{Binding ReadForecastIconUri}" IsEnabled="{Binding IsNotReading}" >
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <cal:ActionMessage MethodName="ReadForecastClickCommand" >
                            <cal:Parameter Value="{Binding SelectedIndex, ElementName=MainPanorama}" />
                        </cal:ActionMessage>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </bab:BindableAppBarButton>
            <bab:BindableAppBarButton Text="Info" IconUri= "{Binding AboutIconUri}" >
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <cal:ActionMessage MethodName="AboutIconClickCommand" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </bab:BindableAppBarButton>
        </bab:BindableAppBar>

    </Grid>

</phone:PhoneApplicationPage>